|
2020-2021 Sunseeker Telemetry and Lighting System
|
#include "driverlib.h"Go to the source code of this file.
Macros | |
| #define | SPICLK 500000 |
Functions | |
| void | main (void) |
| void | USCI_A0_ISR (void) |
Variables | |
| uint8_t | transmitData = 0x00 |
| uint8_t | receiveData = 0x00 |
| uint8_t | returnValue = 0x00 |
| #define SPICLK 500000 |
This example shows how SPI master talks to SPI slave using 3-wire mode. Incrementing data is sent by the master starting at 0x01. Received data is expected to be same as the previous transmission. USCI RX ISR is used to handle communication with the CPU, normally in LPM0. If high, P1.0 indicates valid data reception. Because all execution after LPM0 is in ISRs, initialization waits for DCO to stabilize against ACLK. ACLK = ~32.768kHz, MCLK = SMCLK = DCO ~ 1048kHz. BRCLK = SMCLK/2
Use with SPI Slave Data Echo code example. If slave is in debug mode, P1.1 slave reset signal conflicts with slave's JTAG; to work around, use IAR's "Release JTAG on Go" on slave device. If breakpoints are set in slave RX ISR, master must stopped also to avoid overrunning slave RXBUF.
MSP430F5438A
-----------------
/|\ | |
| | |
Master—+->|RST | | | | P3.4|-> Data Out (UCA0SIMO) | | | P3.5|<- Data In (UCA0SOMI) | | | P3.0|-> Serial Clock Out (UCA0CLK)
This example uses the following peripherals and I/O signals. You must review these and change as needed for your own board:
This example uses the following interrupt handlers. To use this example in your own application you must add these interrupt handlers to your vector table.
Definition at line 82 of file usci_a_spi_ex1_master.c.
| void main | ( | void | ) |
Definition at line 87 of file usci_a_spi_ex1_master.c.
References __delay_cycles(), GPIO_setOutputHighOnPin(), GPIO_setOutputLowOnPin(), param, returnValue, SPICLK, STATUS_FAIL, and transmitData.
| void USCI_A0_ISR | ( | void | ) |
Definition at line 175 of file usci_a_spi_ex1_master.c.
References __delay_cycles(), receiveData, and transmitData.
| uint8_t receiveData = 0x00 |
Definition at line 84 of file usci_a_spi_ex1_master.c.
Referenced by USCI_A0_ISR().
| uint8_t returnValue = 0x00 |
Definition at line 85 of file usci_a_spi_ex1_master.c.
Referenced by main().
| uint8_t transmitData = 0x00 |
Definition at line 84 of file usci_a_spi_ex1_master.c.
Referenced by main(), and USCI_A0_ISR().